#pragma once

#include <iostream>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <cstdint>

class InetAddr
{
public:
    InetAddr(sockaddr_in &addr)
    :_addr(addr)
    {
        _port = addr.sin_port;
        _ip = inet_ntoa(addr.sin_addr);
    }

    const std::string &StringAddr()
    {
        return _ip + ": " + std::to_string(_port);
    }
private:
    sockaddr_in _addr;
    const std::string _ip;
    uint16_t _port;
};